home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 7: Sunsite
/
Linux Cubed Series 7 - Sunsite Vol 1.iso
/
system
/
emulator
/
uae-0.000
/
uae-0
/
uae-0.6.0
/
X86.S
< prev
next >
Wrap
Text File
|
1996-06-17
|
14KB
|
880 lines
/* These are optimized x86 assembly versions of pfield_linetoscr.
* Feel free to send me Sparc/PPC/Alpha versions of this... :)
*/
#ifdef __DOS__
#define SYM(NAME) _##NAME
#define _color_regs _bpl_info
#else
#define SYM(NAME) NAME
#endif
/* Urgl... */
#define color_regs bpl_info
#ifndef __DOS__
.local lastcolor
.comm lastcolor,2
.align 16
#else
.comm lastcolor,2
.align 8
#endif
.globl pfield_linetoscr_full8
pfield_linetoscr_full8:
pushl %ebp
pushl %edi
pushl %esi
pushl %ebx
movl 20(%esp),%esi
movl 24(%esp),%edi
xorl %edx,%edx
movl SYM(diwfirstword),%eax
cmpl $4,%eax
jc .Loops1
movl %edx,SYM(pixdata)-4(%eax)
movl %edx,SYM(spixstate)-4(%eax)
.Loops1:
movl SYM(diwlastword),%eax
movl %edx,SYM(pixdata)(%eax)
movl %edx,SYM(spixstate)(%eax)
movl SYM(acolors),%edx
movb %dl,%dh
movw %dx,%ax
bswapl %eax
movw %dx,%ax
movl SYM(xlinebuffer),%ecx
jmp .L71
.L8:
cmpl 24(%esp),%esi
jge .L5
movl %eax,(%ecx)
addl $4,%ecx
movl %edx,%esi
.L71:
leal 4(%esi),%edx
cmpl %edx,SYM(diwfirstword)
jg .L8
.L5:
movl %ecx,SYM(xlinebuffer)
cmpl $0,SYM(bplham)
je .L9
cmpl $6,SYM(bplplanecnt)
jne .L9
/* HAM */
/* This is invalid in pfield_linetoscr, but it's OK here */
movw SYM(color_regs),%ax
movw %ax,lastcolor
.L73:
cmpl %esi,SYM(diwlastword)
jle .L27
cmpl 24(%esp),%esi
jge .L27
movzbl SYM(pixdata)(%esi),%eax
movl %eax,%edx
andl $48,%edx
cmpl $16,%edx
je .L16
jg .L21
testl %edx,%edx
je .L15
jmp .L14
.L21:
cmpl $32,%edx
je .L17
cmpl $48,%edx
je .L18
jmp .L14
.L15:
movw SYM(color_regs)(,%eax,2),%ax
movw %ax,lastcolor
jmp .L14
.L16:
movw lastcolor,%dx
andw $4080,%dx
andw $15,%ax
jmp .L72
.L17:
movzbw lastcolor,%dx
andw $15,%ax
salw $8,%ax
jmp .L72
.L18:
movw lastcolor,%dx
andw $3855,%dx
andw $15,%ax
salw $4,%ax
.L72:
orw %ax,%dx
movw %dx,lastcolor
.L14:
cmpb $0,SYM(spixstate)(%esi)
je .L22
movsbl SYM(spixels)(%esi),%eax
movl SYM(acolors)+64(,%eax,4),%edx
movl SYM(xlinebuffer),%eax
movb %dl,(%eax)
incl SYM(xlinebuffer)
movb $0,SYM(spixstate)(%esi)
movb $0,SYM(spixels)(%esi)
jmp .L24
.L22:
movzwl lastcolor,%eax
movl SYM(xcolors)(,%eax,4),%edx
movl SYM(xlinebuffer),%eax
movb %dl,(%eax)
incl SYM(xlinebuffer)
.L24:
incl %esi
jmp .L73
.L9:
cmpl $0,SYM(bpldualpf)
je .L74
/* Dual Playfield */
movl $SYM(dblpf_ind1),%ebp
movl $SYM(dblpf_2nd1),%edi
cmpl $0,SYM(bpldualpfpri)
je .L29
movl $SYM(dblpf_ind2),%ebp
movl $SYM(dblpf_2nd2),%edi
.L29:
cmpl %esi,SYM(diwlastword)
jle .L27
cmpl 24(%esp),%esi
jge .L27
xorl %edx,%edx
movl SYM(pixdata)(%esi),%eax
movl SYM(spixstate)(%esi),%ebx
testl %ebx,%ebx
jne .L101
/* no sprites */
movb %al,%dl
movb (%ebp,%edx,4),%dl
movb SYM(acolors)(,%edx,4),%cl
movb %ah,%dl
movb (%ebp,%edx,4),%dl
movb SYM(acolors)(,%edx,4),%ch
bswapl %eax
bswapl %ecx
movb %al,%dl
movb (%ebp,%edx,4),%dl
movb SYM(acolors)(,%edx,4),%cl
movb %ah,%dl
movb (%ebp,%edx,4),%dl
movb SYM(acolors)(,%edx,4),%ch
bswapl %ecx
movl SYM(xlinebuffer),%eax
movl %ecx,(%eax)
addl $4,SYM(xlinebuffer)
addl $4,%esi
jmp .L29
.L101:
/* dual playfield with sprites */
testb %bl,%bl
je .La3
movb %al,%dl
movl (%edi,%edx,4),%edx
testl %edx,%edx
je .La2
pushl %ebp
movl %edx,%ebp
movb %bl,%dl
cmpl plfpri(,%ebp,4),%edx
popl %ebp
jge .La3
.La2:
movb SYM(spixels)(%esi),%dl
movb SYM(acolors)+64(,%edx,4),%cl
jmp .La1
.La3:
movb %al,%dl
movb (%ebp,%edx,4),%dl
movb SYM(acolors)(,%edx,4),%cl
.La1:
testb %bh,%bh
je .La6
movb %ah,%dl
movl (%edi,%edx,4),%edx
testl %edx,%edx
je .La5
pushl %ebp
movl %edx,%ebp
movb %bh,%dl
cmpl plfpri(,%ebp,4),%edx
popl %ebp
jge .La6
.La5:
movb SYM(spixels)+1(%esi),%dl
movb SYM(acolors)+64(,%edx,4),%ch
jmp .La4
.La6:
movb %ah,%dl
movb (%ebp,%edx,4),%dl
movb SYM(acolors)(,%edx,4),%ch
.La4:
bswapl %ecx
bswapl %eax
bswapl %ebx
testb %bl,%bl
je .La9
movb %al,%dl
movl (%edi,%edx,4),%edx
testl %edx,%edx
je .La8
pushl %ebp
movl %edx,%ebp
movb %bl,%dl
cmpl plfpri(,%ebp,4),%edx
popl %ebp
jge .La9
.La8:
movb SYM(spixels)+3(%esi),%dl
movb SYM(acolors)+64(,%edx,4),%cl
jmp .La7
.La9:
movb %al,%dl
movb (%ebp,%edx,4),%dl
movb SYM(acolors)(,%edx,4),%cl
.La7:
testb %bh,%bh
je .La12
movb %ah,%dl
movl (%edi,%edx,4),%edx
testl %edx,%edx
je .La11
pushl %ebp
movl %edx,%ebp
movb %bh,%dl
cmpl plfpri(,%ebp,4),%edx
popl %ebp
jge .La12
.La11:
movb SYM(spixels)+2(%esi),%dl
movb SYM(acolors)+64(,%edx,4),%ch
jmp .La10
.La12:
movb %ah,%dl
movb (%ebp,%edx,4),%dl
movb SYM(acolors)(,%edx,4),%ch
.La10:
movl $0,SYM(spixstate)(%esi)
movl $0,SYM(spixels)(%esi)
addl $4,%esi
bswapl %ecx
movl SYM(xlinebuffer),%eax
movl %ecx,(%eax)
addl $4,SYM(xlinebuffer)
jmp .L29
/* normal case */
.L65:
cmpl 24(%esp),%esi
jge .L27
xorl %edx,%edx
movl SYM(pixdata)(%esi),%eax
movl SYM(spixstate)(%esi),%ebx
testl %ebx,%ebx
jne .L100
/* no sprites */
movb %al,%dl
movb SYM(acolors)(,%edx,4),%cl
movb %ah,%dl
movb SYM(acolors)(,%edx,4),%ch
bswapl %eax
bswapl %ecx
movb %al,%dl
movb SYM(acolors)(,%edx,4),%cl
movb %ah,%dl
movb SYM(acolors)(,%edx,4),%ch
bswapl %ecx
movl SYM(xlinebuffer),%eax
movl %ecx,(%eax)
addl $4,SYM(xlinebuffer)
addl $4,%esi
jmp .L74
.L100:
/* Here, we have to deal with sprites, too. */
testb %bl,%bl
je .L46
testb %al,%al
je .L47
movb %bl,%dl
cmpl SYM(plfpri)+8,%edx
jge .L46
.L47:
movb SYM(spixels)(%esi),%dl
movb SYM(acolors)+64(,%edx,4),%cl
jmp .L75
.L46:
movb %al,%dl
movb SYM(acolors)(,%edx,4),%cl
.L75:
testb %bh,%bh
je .L51
testb %ah,%ah
je .L52
movb %bh,%dl
cmpl SYM(plfpri)+8,%edx
jge .L51
.L52:
movb SYM(spixels)+1(%esi),%dl
movb SYM(acolors)+64(,%edx,4),%ch
jmp .L76
.L51:
movb %ah,%dl
movb SYM(acolors)(,%edx,4),%ch
.L76:
bswapl %ebx
bswapl %ecx
bswapl %eax
testb %bl,%bl
je .L56
testb %al,%al
je .L55
movb %bl,%dl
cmpl SYM(plfpri)+8,%edx
jge .L56
.L55:
movb SYM(spixels)+3(%esi),%dl
movb SYM(acolors)+64(,%edx,4),%cl
jmp .L57
.L56:
movb %al,%dl
movb SYM(acolors)(,%edx,4),%cl
.L57:
testb %bh,%bh
je .L58
testb %ah,%ah
je .L59
movb %bh,%dl
cmpl SYM(plfpri)+8,%edx
jge .L58
.L59:
movb SYM(spixels)+2(%esi),%dl
movb SYM(acolors)+64(,%edx,4),%ch
jmp .L60
.L58:
movb %ah,%dl
movb SYM(acolors)(,%edx,4),%ch
.L60:
movl $0,SYM(spixstate)(%esi)
movl $0,SYM(spixels)(%esi)
addl $4,%esi
bswapl %ecx
movl SYM(xlinebuffer),%eax
movl %ecx,(%eax)
addl $4,SYM(xlinebuffer)
.L74:
cmpl %esi,SYM(diwlastword)
jg .L65
.L27:
/* Finish off the line */
movl SYM(acolors),%edx
movb %dl,%dh
movw %dx,%ax
bswapl %eax
movw %dx,%ax
movl SYM(xlinebuffer),%ecx
movl 24(%esp),%edi
.L70:
cmpl %edi,%esi
jge .L66
movl %eax,(%ecx)
addl $4,%ecx
addl $4,%esi
jmp .L70
.L66:
movl %ecx,SYM(xlinebuffer)
popl %ebx
popl %esi
popl %edi
popl %ebp
ret
.Lfe2:
#ifndef __DOS__
.align 16
#else
.align 8
#endif
.globl pfield_linetoscr_full16
pfield_linetoscr_full16:
pushl %edi
pushl %esi
pushl %ebx
pushl %ebp
xorl %edx,%edx
movl SYM(diwfirstword),%eax
cmpl $4,%eax
jc .Loops2
movl %edx,SYM(pixdata)-4(%eax)
movl %edx,SYM(spixstate)-4(%eax)
.Loops2:
movl SYM(diwlastword),%eax
movl %edx,SYM(pixdata)(%eax)
movl %edx,SYM(spixstate)(%eax)
movl 20(%esp),%esi
movw SYM(acolors),%ax
sall $16,%eax
movw SYM(acolors),%ax
movl SYM(xlinebuffer),%ecx
jmp .L2443
.L2447:
cmpl 24(%esp),%esi
jge .L2400
movl %eax,(%ecx)
movl %eax,4(%ecx)
addl $8,%ecx
movl %edx,%esi
.L2443:
leal 4(%esi),%edx
cmpl %edx,SYM(diwfirstword)
jg .L2447
.L2400:
movl %ecx,SYM(xlinebuffer)
cmpl $0,SYM(bplham)
je .L2448
cmpl $6,SYM(bplplanecnt)
jne .L2448
/* HAM */
/* This is invalid in pfield_linetoscr, but it's OK here */
movw SYM(color_regs),%ax
movw %ax,lastcolor
.L2499:
cmpl %esi,SYM(diwlastword)
jle .L2027
cmpl 24(%esp),%esi
jge .L2494
movzbl SYM(pixdata)(%esi),%eax
movl %eax,%edx
andl $48,%edx
cmpl $16,%edx
je .L2455
jg .L2460
testl %edx,%edx
je .L2454
jmp .L2453
.L2460:
cmpl $32,%edx
je .L2456
cmpl $48,%edx
je .L2457
jmp .L2453
.L2454:
movw SYM(color_regs)(,%eax,2),%ax
movw %ax,lastcolor
jmp .L2453
.L2455:
movw lastcolor,%dx
andw $4080,%dx
andw $15,%ax
jmp .L2498
.L2456:
movzbw lastcolor,%dx
andw $15,%ax
salw $8,%ax
jmp .L2498
.L2457:
movw lastcolor,%dx
andw $3855,%dx
andw $15,%ax
salw $4,%ax
.L2498:
orw %ax,%dx
movw %dx,lastcolor
.L2453:
cmpb $0,SYM(spixstate)(%esi)
je .L2461
movsbl SYM(spixels)(%esi),%eax
movl SYM(acolors)+64(,%eax,4),%edx
movl SYM(xlinebuffer),%eax
movw %dx,(%eax)
addl $2,SYM(xlinebuffer)
movb $0,SYM(spixstate)(%esi)
movb $0,SYM(spixels)(%esi)
jmp .L2463
.L2461:
movzwl lastcolor,%eax
movl SYM(xcolors)(,%eax,4),%edx
movl SYM(xlinebuffer),%eax
movw %dx,(%eax)
addl $2,SYM(xlinebuffer)
.L2463:
incl %esi
jmp .L2499
.L2448:
cmpl $0,SYM(bpldualpf)
je .L2500
/* Dual Playfield */
xorl %edx,%edx
movl $SYM(dblpf_ind1),%ebp
movl $SYM(dblpf_2nd1),%edi
cmpl $0,SYM(bpldualpfpri)
je .L2468
movl $SYM(dblpf_ind2),%ebp
movl $SYM(dblpf_2nd2),%edi
.L2468:
cmpl %esi,SYM(diwlastword)
jle .L2027
cmpl 24(%esp),%esi
jge .L2494
movl SYM(pixdata)(%esi),%eax
movl SYM(spixstate)(%esi),%ebx
testl %ebx,%ebx
jne .Lb0
/* Dual Playfield, no sprites */
movl SYM(xlinebuffer),%ebx
movb %ah,%dl
movb (%ebp,%edx,4),%dl
movw SYM(acolors)(,%edx,4),%cx
sall $16,%ecx
movb %al,%dl
movb (%ebp,%edx,4),%dl
movw SYM(acolors)(,%edx,4),%cx
movl %ecx,(%ebx)
bswapl %eax
movb %al,%dl
movb (%ebp,%edx,4),%dl
movw SYM(acolors)(,%edx,4),%cx
sall $16,%ecx
movb %ah,%dl
movb (%ebp,%edx,4),%dl
movw SYM(acolors)(,%edx,4),%cx
movl %ecx,4(%ebx)
addl $8,SYM(xlinebuffer)
addl $4,%esi
jmp .L2468
/* Dual Playfield with sprites */
.Lb0:
testb %bh,%bh
je .Lb3
movb %ah,%dl
movl (%edi,%edx,4),%edx
testl %edx,%edx
je .Lb2
pushl %ebp
movl %edx,%ebp
movb %bh,%dl
cmpl plfpri(,%ebp,4),%edx
popl %ebp
jge .Lb3
.Lb2:
movb SYM(spixels)+1(%esi),%dl
movw SYM(acolors)+64(,%edx,4),%cx
jmp .Lb1
.Lb3:
movb %ah,%dl
movb (%ebp,%edx,4),%dl
movw SYM(acolors)(,%edx,4),%cx
.Lb1:
sall $16,%ecx
testb %bl,%bl
je .Lb6
movb %al,%dl
movl (%edi,%edx,4),%edx
testl %edx,%edx
je .Lb5
pushl %ebp
movl %edx,%ebp
movb %bl,%dl
cmpl plfpri(,%ebp,4),%edx
popl %ebp
jge .Lb6
.Lb5:
movb SYM(spixels)(%esi),%dl
movw SYM(acolors)+64(,%edx,4),%cx
jmp .Lb4
.Lb6:
movb %al,%dl
movb (%ebp,%edx,4),%dl
movw SYM(acolors)(,%edx,4),%cx
.Lb4:
pushl %eax
movl SYM(xlinebuffer),%eax
movl %ecx,(%eax)
popl %eax
bswapl %ebx
bswapl %eax
testb %bl,%bl
je .Lb9
movb %al,%dl
movl (%edi,%edx,4),%edx
testl %edx,%edx
je .Lb8
pushl %ebp
movl %edx,%ebp
movb %bl,%dl
cmpl plfpri(,%ebp,4),%edx
popl %ebp
jge .Lb9
.Lb8:
movb SYM(spixels)+3(%esi),%dl
movw SYM(acolors)+64(,%edx,4),%cx
jmp .Lb7
.Lb9:
movb %al,%dl
movb (%ebp,%edx,4),%dl
movw SYM(acolors)(,%edx,4),%cx
.Lb7:
sall $16,%ecx
testb %bh,%bh
je .Lb12
movb %ah,%dl
movl (%edi,%edx,4),%edx
testl %edx,%edx
je .Lb11
pushl %ebp
movl %edx,%ebp
movb %bh,%dl
cmpl plfpri(,%ebp,4),%edx
popl %ebp
jge .Lb12
.Lb11:
movb SYM(spixels)+2(%esi),%dl
movw SYM(acolors)+64(,%edx,4),%cx
jmp .Lb10
.Lb12:
movb %ah,%dl
movb (%ebp,%edx,4),%dl
movw SYM(acolors)(,%edx,4),%cx
.Lb10:
movl $0,SYM(spixstate)(%esi)
movl $0,SYM(spixels)(%esi)
addl $4,%esi
movl SYM(xlinebuffer),%eax
movl %ecx,4(%eax)
addl $8,SYM(xlinebuffer)
jmp .L2468
#if 0
movsbl SYM(spixels)(%esi),%eax
movl SYM(acolors)+64(,%eax,4),%edx
movl SYM(xlinebuffer),%eax
movw %dx,(%eax)
addl $2,SYM(xlinebuffer)
movb $0,SYM(spixstate)(%esi)
movb $0,SYM(spixels)(%esi)
jmp .L2476
.L2474:
movzbl SYM(pixdata)(%esi),%eax
movl (%ebp,%eax,4),%eax
movl SYM(acolors)(,%eax,4),%edx
movl SYM(xlinebuffer),%eax
movw %dx,(%eax)
addl $2,SYM(xlinebuffer)
.L2476:
incl %esi
jmp .L2468
#endif
/* Normal case */
.L2492:
cmpl 24(%esp),%esi
jge .L2027
xorl %edx,%edx
movl SYM(pixdata)(%esi),%eax
movl SYM(spixstate)(%esi),%ebx
testl %ebx,%ebx
jne .L20100
/* no sprites */
movl SYM(xlinebuffer),%ebp
movb %ah,%dl
movw SYM(acolors)(,%edx,4),%cx
sall $16,%ecx
movb %al,%dl
movw SYM(acolors)(,%edx,4),%cx
movl %ecx,(%ebp)
bswapl %eax
movb %al,%dl
movw SYM(acolors)(,%edx,4),%cx
sall $16,%ecx
movb %ah,%dl
movw SYM(acolors)(,%edx,4),%cx
movl %ecx,4(%ebp)
addl $8,%ebp
movl %ebp,SYM(xlinebuffer)
addl $4,%esi
jmp .L2500
.L20100:
/* Here, we have to deal with sprites, too. */
movl SYM(xlinebuffer),%ebp
testb %bh,%bh
je .L2051
testb %ah,%ah
je .L2052
movb %bh,%dl
cmpl SYM(plfpri)+8,%edx
jge .L2051
.L2052:
movb SYM(spixels)+1(%esi),%dl
movw SYM(acolors)+64(,%edx,4),%cx
jmp .L2076
.L2051:
movb %ah,%dl
movw SYM(acolors)(,%edx,4),%cx
.L2076:
sall $16,%ecx
testb %bl,%bl
je .L2046
testb %al,%al
je .L2047
movb %bl,%dl
cmpl SYM(plfpri)+8,%edx
jge .L2046
.L2047:
movb SYM(spixels)(%esi),%dl
movw SYM(acolors)+64(,%edx,4),%cx
jmp .L2075
.L2046:
movb %al,%dl
movw SYM(acolors)(,%edx,4),%cx
.L2075:
bswapl %ebx
bswapl %eax
movl %ecx,(%ebp)
testb %bl,%bl
je .L2056
testb %al,%al
je .L2055
movb %bl,%dl
cmpl SYM(plfpri)+8,%edx
jge .L2056
.L2055:
movb SYM(spixels)+3(%esi),%dl
movw SYM(acolors)+64(,%edx,4),%cx
jmp .L2057
.L2056:
movb %al,%dl
movw SYM(acolors)(,%edx,4),%cx
.L2057:
sall $16,%ecx
testb %bh,%bh
je .L2058
testb %ah,%ah
je .L2059
movb %bh,%dl
cmpl SYM(plfpri)+8,%edx
jge .L2058
.L2059:
movb SYM(spixels)+2(%esi),%dl
movw SYM(acolors)+64(,%edx,4),%cx
jmp .L2060
.L2058:
movb %ah,%dl
movw SYM(acolors)(,%edx,4),%cx
.L2060:
movl %ecx,4(%ebp)
movl $0,SYM(spixstate)(%esi)
movl $0,SYM(spixels)(%esi)
addl $4,%esi
addl $8,SYM(xlinebuffer)
.L2500:
cmpl %esi,SYM(diwlastword)
jg .L2492
/* Finish off the line */
.L2027:
movl 24(%esp),%edi
cmpl %edi,%esi
jnl .L2494
movl SYM(acolors),%edx
movl SYM(xlinebuffer),%eax
.L2495:
incl %esi
movw %dx,(%eax)
addl $2,%eax
cmpl %edi,%esi
jl .L2495
movl %eax,SYM(xlinebuffer)
.L2494:
popl %ebp
popl %ebx
popl %esi
popl %edi
ret
.Lfe21:
.ident "Crux CC 3.14.15"